import 'package:flutter/material.dart';
import 'package:rss_readneed/punch_card/page.dart' as punch_card;//打卡

import 'package:rss_readneed/punch_card/simple_show_sn/page.dart' as simple_show_sn;//苏宁定制简单展示

import 'package:rss_readneed/sn_support/SNAccount.dart';

class MainTabBar extends StatefulWidget {
  @override
  MainTabBarState createState() => new MainTabBarState();
}

class MainTabBarState extends State<MainTabBar> {

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
//      body:punch_card.punch_cardPage().buildPage({}),
//      body:simple_show_sn.simple_show_snPage().buildPage({}),
      body: firstPage(),
    );
  }

  Widget firstPage () {

    if (SNAccount.instance.isSnPageFirst == true){

      return simple_show_sn.simple_show_snPage().buildPage({});
    } else {
      return punch_card.punch_cardPage().buildPage({});
    }
  }
  
  @override
  void initState() {
    super.initState();

    SNAccount.noti.stream.listen((_){

      setState(() {

      });
    });
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  void didUpdateWidget(MainTabBar oldWidget) {
    // TODO: implement didUpdateWidget
    super.didUpdateWidget(oldWidget);
  }

  @override
  void didChangeDependencies() {
    // TODO: implement didChangeDependencies
    super.didChangeDependencies();
  }
}